<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>综合练习</title>
    <style>
        img {
            width: 50px;
            height: 50px
        }
    </style>
</head>
<body>
<input type="text" placeholder="请输入数量">
<input type="button" value="帅哥" onclick="f(1)"> <!--1则是帅哥图片-->
<input type="button" value="美女" onclick="f(2)"> <!--不是1则是美女图片-->

<script>
    let i = document.querySelector("input");

    function f(x) {
        for (let j = 0; j < i.value; j++) {
            let imgName = x == 1 ? "man.jpg" : "woman.jpg";
            let img = document.createElement("img"); //创建图片标签
            img.src = imgName; //设置图片的显示内容
            document.body.append(img); //添加图片标签到body里面
        }
    }
</script>

</body>
</html>